﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TRPOP.CRM.Component.Common
{
    /// <summary>
    /// 系统常量
    /// </summary>
    public class SystemConst
    {
        /// <summary>
        /// 系统操作日志 关键字 
        /// </summary>
        public enum SystemOperationKey
        {
            /// <summary>
            /// 系统异常
            /// </summary>
            SystemError = 1,

            /// <summary>
            /// 登录成功
            /// </summary>
            SystemLogin = 2,

            /// <summary>
            /// 登录失败
            /// </summary>
            SystemLoginError = 3
        }

        /// <summary>
        /// 当前的 employee Session Key
        /// </summary>
        public const string EmployeeSessionKey = "TRPOP.CRM.CurrentEmployee";

        /// <summary>
        /// 当前 employee Session Permission Key
        /// </summary>
        public const string EmployeeSessionPermissiobKey = "TRPOP.CRM.CurrentEmployeePermission";

        /// <summary>
        /// 等级之间的间隔符
        /// </summary>
        public const string TreeLevel = "— ";

        static SystemConst()
        {
            if (m_AllCompanyStatus == null)
            {
                m_AllCompanyStatus = new Dictionary<int, string>();
            }

            if (m_AllCompanyStatus.Count <= 0)
            {
                m_AllCompanyStatus.Add(1, "占用");
                m_AllCompanyStatus.Add(2, "公共");
            }
        }

        static Dictionary<int, string> m_AllCompanyStatus;
        /// <summary>
        /// 获取所有的客户状态
        /// </summary>
        /// <returns></returns>
        public static Dictionary<int, string> AllCompanyStatus()
        {
            return m_AllCompanyStatus;
        }
        /// <summary>
        /// 根据 CompanyStatus id 获取 Name
        /// </summary>
        /// <param name="intCompanyStatus"></param>
        /// <returns></returns>
        public static string GetCompanyStatusName(int intCompanyStatus)
        {
            switch (intCompanyStatus)
            {
                case 1:
                    return "<span class='c_red'>" + m_AllCompanyStatus[intCompanyStatus] + "</span>";
                default:
                    return m_AllCompanyStatus[intCompanyStatus];
            }
        }
    }
}
